import request from '@/utils/request'

export function getUserList(data) {
  return request({
    url: '/sysUser/find',
    method: 'post',
    data
  })
}
export function addUserSave(data) {
  return request({
    url: '/sysUser/save',
    method: 'post',
    data
  })
}
export function delUser(id) {
  return request({
    url: `/sysUser/del/${id}`,
    method: 'get',
  })
}
export function delBatchUser(ids) {
  return request({
    url: `/sysUser/delBatch?ids=${ids}`,
    method: 'get',
  })
}
//冻结用户-批量冻结
export function disableUser(id) {
  return request({
    url: `/sysUser/disable/${id}`,
    method: 'get',
  })
}
//批量冻结
export function disableBatchUser(data) {
  return request({
    url: '/sysUser/disableBatch',
    method: 'post',
    data
  })
}
//解冻用户-批量解冻
export function enableUser(id) {
  return request({
    url: `/sysUser/enable/${id}`,
    method: 'get',
  })
}
//批量解冻
export function enableBatchUser(data) {
  return request({
    url: '/sysUser/enableBatch',
    method: 'post',
    data
  })
}
//用户角色
export function roleUser(id) {
  return request({
    url: `/sysUser/findUserRole/${id}`,
    method: 'get',
  })
}
//重置密码
export function resetPwdUser(data) {
  return request({
    url: '/sysUser/resetPwd',
    method: 'post',
    data
  })
}
//忘记密码
export function forgotPwd(data) {
         return request({
           url: "/sysUser/forgotPwd",
           method: "post",
           data
         });
       }
//用户详情
export function getUserDetails(id) {
  return request({
    url: `/sysUser/getDetail/${id}`,
    method: 'get',
  })
}

//---------------------------------------------------------------------------------角色
export function getRoleList(data) {
  return request({
    url: '/sysRole/findAll',
    method: 'post',
    data
  })
}
export function delRole(id) {
  return request({
    url: `/sysRole/del/${id}`,
    method: 'get'
  })
}
export function saveRole(data) {
  return request({
    url: '/sysRole/save',
    method: 'post',
    data
  })
}
//禁用
export function disableRole(id) {
  return request({
    url: `/sysRole/disable/${id}`,
    method:'get',
  })
}
//启用
export function enableRole(id) {
  return request({
    url: `/sysRole/enable/${id}`,
    method:'get',
  })
}
//获取角色权限
export function getRolePermission(id) {
  return request({
    url: `/sysRole/getMenuId/${id}`,
    method:'get',
  })
}

//---------------------------------------------------------------------------------权限
export function getPermissionList(data) {
  return request({
    url: '/sysMenu/findListByPid',
    method: 'post',
    data
  })
}
export function savePermission(data) {
  return request({
    url: '/sysMenu/save',
    method: 'post',
    data
  })
}
export function delPermission(id) {
  return request({
    url: `/sysMenu/del/${id}`,
    method:'get',
  })
}
export function enablePermission(id) {
  return request({
    url: `/sysMenu/enable/${id}`,
    method:'get',
  })
}
export function disablePermission(id) {
  return request({
    url: `/sysMenu/disable/${id}`,
    method:'get',
  })
}


/**-----------------------------------------------------------------------------------------职位 */
export function getPositionList(data) {
  return request({
    url: '/sysPosition/findAll',
    method: 'post',
    data
  })
}
export function delPosition(id) {
  return request({
    url: `/sysPosition/del/${id}`,
    method: 'get',
  })
}
export function savePosition(data) {
  return request({
    url: '/sysPosition/save',
    method: 'post',
    data
  })
}
export function getPositionData(data) {
  return request({
    url: "/sysPosition/findPositionList",
    method: "post",
    data
  });
}



/**-----------------------------------------------------------------------------------------部门 */


export function getDepartmentList(data) {
  return request({
    url: '/sysDept/findListByPid',
    method: 'post',
    data
  })
}
export function delDepartment(id) {
  return request({
    url: `/sysDept/del/${id}`,
    method: 'get',
  })
}
export function saveDepartment(data) {
  return request({
    url: '/sysDept/save',
    method: 'post',
    data
  })
}


/**-----------------------------------------------------------------------------------------工作流 */
export function getNodeList(data) {
  return request({
    url: '/flowJob/find',
    method: 'post',
    data
  })
}
export function saveNode(data) {
  return request({
    url: '/flowJob/save',
    method: 'post',
    data
  })
}
export function getNodeStatus(jobId) {
  return request({
    url: `/flowJob/findJobState/${jobId}`,
    method: 'get',
  })
}
export function getAllNode(jobId) {
  return request({
    url: `/flowJob/findJobStateDetail/${jobId}`,
    method: 'get',
  })
}
export function saveAllNode(data,jobId) {
  return request({
    url: `/flowJob/saveJobStateChange/${jobId}`,
    method: 'post',
    data
  })
}
export function saveAllUserRole(data) {
  return request({
    url: '/flowJob/saveStateRoleUser',
    method: 'post',
    data
  })
}
export function getStateUser(stateId) {
  return request({
    url: `/flowJob/findStateDetail/${stateId}`,
    method: 'get',
  })
}


/**-----------------------------------------------------------------------------------------数据日志 */
export function getDataLogList(data) {
  return request({
    url: '/sysLog2/find',
    method: 'post',
    data
  })
}
/**-----------------------------------------------------------------------------------------操作日志 */
export function getOperationLogList(data) {
  return request({
    url: '/sysLoginLog/find',
    method: 'post',
    data
  })
}